package diagUMLm;

import com.mxgraph.canvas.mxICanvas;
import com.mxgraph.canvas.mxImageCanvas;
import com.mxgraph.view.mxCellState;
import com.mxgraph.view.mxGraph;


public class Mymxgraph extends mxGraph {
	
	public Mymxgraph(){
		super();
		
	}

	public boolean isCellEditable(Object cell)
	{
		return true;
		//!getModel().isVertex(cell);
	}
	
	public void drawState(mxICanvas canvas, mxCellState state,
			boolean drawLabel)
	{
		String label = (drawLabel) ? state.getLabel() : "";

		
		if (getModel().isVertex(state.getCell())
				&& canvas instanceof mxImageCanvas
				&& ((mxImageCanvas) canvas).getGraphicsCanvas() instanceof Canevas)
		{
			((Canevas) ((mxImageCanvas) canvas).getGraphicsCanvas())
					.drawVertex(state, label);
		}
		// Redirection of drawing vertices in Canevas
		else if (getModel().isVertex(state.getCell())
				&& canvas instanceof Canevas)
		{
			((Canevas) canvas).drawVertex(state, label);
		}
		else
		{
			super.drawState(canvas, state, drawLabel);
		}
	}
	
}
